
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _Contracts : SqlClientEntity
	{
		public _Contracts()
		{
			this.QuerySource = "Contracts";
			this.MappingName = "Contracts";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ContractsLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_ContractsLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter ContractNo
			{
				get
				{
					return new SqlParameter("@ContractNo", SqlDbType.Char, 10);
				}
			}
			
			public static SqlParameter ProductDetailID
			{
				get
				{
					return new SqlParameter("@ProductDetailID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Cost
			{
				get
				{
					return new SqlParameter("@Cost", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter MobileNumber
			{
				get
				{
					return new SqlParameter("@MobileNumber", SqlDbType.NVarChar, 20);
				}
			}
			
			public static SqlParameter PlanDescription
			{
				get
				{
					return new SqlParameter("@PlanDescription", SqlDbType.NVarChar, 100);
				}
			}
			
			public static SqlParameter PlanDuration
			{
				get
				{
					return new SqlParameter("@PlanDuration", SqlDbType.TinyInt, 0);
				}
			}
			
			public static SqlParameter Commission
			{
				get
				{
					return new SqlParameter("@Commission", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter Rebate
			{
				get
				{
					return new SqlParameter("@Rebate", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter MPP
			{
				get
				{
					return new SqlParameter("@MPP", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter NetworkID
			{
				get
				{
					return new SqlParameter("@NetworkID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter InvoiceID
			{
				get
				{
					return new SqlParameter("@InvoiceID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter LastModifiedDate
			{
				get
				{
					return new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedByUser
			{
				get
				{
					return new SqlParameter("@LastModifiedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter CreatedDate
			{
				get
				{
					return new SqlParameter("@CreatedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter CreatedByUser
			{
				get
				{
					return new SqlParameter("@CreatedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter Memo
			{
				get
				{
					return new SqlParameter("@Memo", SqlDbType.NVarChar, 1073741823);
				}
			}
			
			public static SqlParameter ContractCreatedDate
			{
				get
				{
					return new SqlParameter("@ContractCreatedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter ContractStartDate
			{
				get
				{
					return new SqlParameter("@ContractStartDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter ContractEndDate
			{
				get
				{
					return new SqlParameter("@ContractEndDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string ContractNo = "ContractNo";
            public const string ProductDetailID = "ProductDetailID";
            public const string Cost = "Cost";
            public const string MobileNumber = "MobileNumber";
            public const string PlanDescription = "PlanDescription";
            public const string PlanDuration = "PlanDuration";
            public const string Commission = "Commission";
            public const string Rebate = "Rebate";
            public const string MPP = "MPP";
            public const string NetworkID = "NetworkID";
            public const string InvoiceID = "InvoiceID";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string Deleted = "Deleted";
            public const string CreatedDate = "CreatedDate";
            public const string CreatedByUser = "CreatedByUser";
            public const string Memo = "Memo";
            public const string ContractCreatedDate = "ContractCreatedDate";
            public const string ContractStartDate = "ContractStartDate";
            public const string ContractEndDate = "ContractEndDate";
            public const string BranchID = "BranchID";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Contracts.PropertyNames.ID;
					ht[ContractNo] = _Contracts.PropertyNames.ContractNo;
					ht[ProductDetailID] = _Contracts.PropertyNames.ProductDetailID;
					ht[Cost] = _Contracts.PropertyNames.Cost;
					ht[MobileNumber] = _Contracts.PropertyNames.MobileNumber;
					ht[PlanDescription] = _Contracts.PropertyNames.PlanDescription;
					ht[PlanDuration] = _Contracts.PropertyNames.PlanDuration;
					ht[Commission] = _Contracts.PropertyNames.Commission;
					ht[Rebate] = _Contracts.PropertyNames.Rebate;
					ht[MPP] = _Contracts.PropertyNames.MPP;
					ht[NetworkID] = _Contracts.PropertyNames.NetworkID;
					ht[InvoiceID] = _Contracts.PropertyNames.InvoiceID;
					ht[LastModifiedDate] = _Contracts.PropertyNames.LastModifiedDate;
					ht[LastModifiedByUser] = _Contracts.PropertyNames.LastModifiedByUser;
					ht[Deleted] = _Contracts.PropertyNames.Deleted;
					ht[CreatedDate] = _Contracts.PropertyNames.CreatedDate;
					ht[CreatedByUser] = _Contracts.PropertyNames.CreatedByUser;
					ht[Memo] = _Contracts.PropertyNames.Memo;
					ht[ContractCreatedDate] = _Contracts.PropertyNames.ContractCreatedDate;
					ht[ContractStartDate] = _Contracts.PropertyNames.ContractStartDate;
					ht[ContractEndDate] = _Contracts.PropertyNames.ContractEndDate;
					ht[BranchID] = _Contracts.PropertyNames.BranchID;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string ContractNo = "ContractNo";
            public const string ProductDetailID = "ProductDetailID";
            public const string Cost = "Cost";
            public const string MobileNumber = "MobileNumber";
            public const string PlanDescription = "PlanDescription";
            public const string PlanDuration = "PlanDuration";
            public const string Commission = "Commission";
            public const string Rebate = "Rebate";
            public const string MPP = "MPP";
            public const string NetworkID = "NetworkID";
            public const string InvoiceID = "InvoiceID";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string Deleted = "Deleted";
            public const string CreatedDate = "CreatedDate";
            public const string CreatedByUser = "CreatedByUser";
            public const string Memo = "Memo";
            public const string ContractCreatedDate = "ContractCreatedDate";
            public const string ContractStartDate = "ContractStartDate";
            public const string ContractEndDate = "ContractEndDate";
            public const string BranchID = "BranchID";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Contracts.ColumnNames.ID;
					ht[ContractNo] = _Contracts.ColumnNames.ContractNo;
					ht[ProductDetailID] = _Contracts.ColumnNames.ProductDetailID;
					ht[Cost] = _Contracts.ColumnNames.Cost;
					ht[MobileNumber] = _Contracts.ColumnNames.MobileNumber;
					ht[PlanDescription] = _Contracts.ColumnNames.PlanDescription;
					ht[PlanDuration] = _Contracts.ColumnNames.PlanDuration;
					ht[Commission] = _Contracts.ColumnNames.Commission;
					ht[Rebate] = _Contracts.ColumnNames.Rebate;
					ht[MPP] = _Contracts.ColumnNames.MPP;
					ht[NetworkID] = _Contracts.ColumnNames.NetworkID;
					ht[InvoiceID] = _Contracts.ColumnNames.InvoiceID;
					ht[LastModifiedDate] = _Contracts.ColumnNames.LastModifiedDate;
					ht[LastModifiedByUser] = _Contracts.ColumnNames.LastModifiedByUser;
					ht[Deleted] = _Contracts.ColumnNames.Deleted;
					ht[CreatedDate] = _Contracts.ColumnNames.CreatedDate;
					ht[CreatedByUser] = _Contracts.ColumnNames.CreatedByUser;
					ht[Memo] = _Contracts.ColumnNames.Memo;
					ht[ContractCreatedDate] = _Contracts.ColumnNames.ContractCreatedDate;
					ht[ContractStartDate] = _Contracts.ColumnNames.ContractStartDate;
					ht[ContractEndDate] = _Contracts.ColumnNames.ContractEndDate;
					ht[BranchID] = _Contracts.ColumnNames.BranchID;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string ContractNo = "s_ContractNo";
            public const string ProductDetailID = "s_ProductDetailID";
            public const string Cost = "s_Cost";
            public const string MobileNumber = "s_MobileNumber";
            public const string PlanDescription = "s_PlanDescription";
            public const string PlanDuration = "s_PlanDuration";
            public const string Commission = "s_Commission";
            public const string Rebate = "s_Rebate";
            public const string MPP = "s_MPP";
            public const string NetworkID = "s_NetworkID";
            public const string InvoiceID = "s_InvoiceID";
            public const string LastModifiedDate = "s_LastModifiedDate";
            public const string LastModifiedByUser = "s_LastModifiedByUser";
            public const string Deleted = "s_Deleted";
            public const string CreatedDate = "s_CreatedDate";
            public const string CreatedByUser = "s_CreatedByUser";
            public const string Memo = "s_Memo";
            public const string ContractCreatedDate = "s_ContractCreatedDate";
            public const string ContractStartDate = "s_ContractStartDate";
            public const string ContractEndDate = "s_ContractEndDate";
            public const string BranchID = "s_BranchID";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual string ContractNo
	    {
			get
	        {
				return base.Getstring(ColumnNames.ContractNo);
			}
			set
	        {
				base.Setstring(ColumnNames.ContractNo, value);
			}
		}

		public virtual int ProductDetailID
	    {
			get
	        {
				return base.Getint(ColumnNames.ProductDetailID);
			}
			set
	        {
				base.Setint(ColumnNames.ProductDetailID, value);
			}
		}

		public virtual decimal Cost
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.Cost);
			}
			set
	        {
				base.Setdecimal(ColumnNames.Cost, value);
			}
		}

		public virtual string MobileNumber
	    {
			get
	        {
				return base.Getstring(ColumnNames.MobileNumber);
			}
			set
	        {
				base.Setstring(ColumnNames.MobileNumber, value);
			}
		}

		public virtual string PlanDescription
	    {
			get
	        {
				return base.Getstring(ColumnNames.PlanDescription);
			}
			set
	        {
				base.Setstring(ColumnNames.PlanDescription, value);
			}
		}

		public virtual byte PlanDuration
	    {
			get
	        {
				return base.Getbyte(ColumnNames.PlanDuration);
			}
			set
	        {
				base.Setbyte(ColumnNames.PlanDuration, value);
			}
		}

		public virtual decimal Commission
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.Commission);
			}
			set
	        {
				base.Setdecimal(ColumnNames.Commission, value);
			}
		}

		public virtual decimal Rebate
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.Rebate);
			}
			set
	        {
				base.Setdecimal(ColumnNames.Rebate, value);
			}
		}

		public virtual decimal MPP
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.MPP);
			}
			set
	        {
				base.Setdecimal(ColumnNames.MPP, value);
			}
		}

		public virtual int NetworkID
	    {
			get
	        {
				return base.Getint(ColumnNames.NetworkID);
			}
			set
	        {
				base.Setint(ColumnNames.NetworkID, value);
			}
		}

		public virtual int InvoiceID
	    {
			get
	        {
				return base.Getint(ColumnNames.InvoiceID);
			}
			set
	        {
				base.Setint(ColumnNames.InvoiceID, value);
			}
		}

		public virtual DateTime LastModifiedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.LastModifiedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual int LastModifiedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual DateTime CreatedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.CreatedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.CreatedDate, value);
			}
		}

		public virtual int CreatedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.CreatedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.CreatedByUser, value);
			}
		}

		public virtual string Memo
	    {
			get
	        {
				return base.Getstring(ColumnNames.Memo);
			}
			set
	        {
				base.Setstring(ColumnNames.Memo, value);
			}
		}

		public virtual DateTime ContractCreatedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.ContractCreatedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.ContractCreatedDate, value);
			}
		}

		public virtual DateTime ContractStartDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.ContractStartDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.ContractStartDate, value);
			}
		}

		public virtual DateTime ContractEndDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.ContractEndDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.ContractEndDate, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_ContractNo
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ContractNo) ? string.Empty : base.GetstringAsString(ColumnNames.ContractNo);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ContractNo);
				else
					this.ContractNo = base.SetstringAsString(ColumnNames.ContractNo, value);
			}
		}

		public virtual string s_ProductDetailID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ProductDetailID) ? string.Empty : base.GetintAsString(ColumnNames.ProductDetailID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ProductDetailID);
				else
					this.ProductDetailID = base.SetintAsString(ColumnNames.ProductDetailID, value);
			}
		}

		public virtual string s_Cost
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Cost) ? string.Empty : base.GetdecimalAsString(ColumnNames.Cost);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Cost);
				else
					this.Cost = base.SetdecimalAsString(ColumnNames.Cost, value);
			}
		}

		public virtual string s_MobileNumber
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MobileNumber) ? string.Empty : base.GetstringAsString(ColumnNames.MobileNumber);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MobileNumber);
				else
					this.MobileNumber = base.SetstringAsString(ColumnNames.MobileNumber, value);
			}
		}

		public virtual string s_PlanDescription
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PlanDescription) ? string.Empty : base.GetstringAsString(ColumnNames.PlanDescription);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PlanDescription);
				else
					this.PlanDescription = base.SetstringAsString(ColumnNames.PlanDescription, value);
			}
		}

		public virtual string s_PlanDuration
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PlanDuration) ? string.Empty : base.GetbyteAsString(ColumnNames.PlanDuration);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PlanDuration);
				else
					this.PlanDuration = base.SetbyteAsString(ColumnNames.PlanDuration, value);
			}
		}

		public virtual string s_Commission
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Commission) ? string.Empty : base.GetdecimalAsString(ColumnNames.Commission);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Commission);
				else
					this.Commission = base.SetdecimalAsString(ColumnNames.Commission, value);
			}
		}

		public virtual string s_Rebate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Rebate) ? string.Empty : base.GetdecimalAsString(ColumnNames.Rebate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Rebate);
				else
					this.Rebate = base.SetdecimalAsString(ColumnNames.Rebate, value);
			}
		}

		public virtual string s_MPP
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.MPP) ? string.Empty : base.GetdecimalAsString(ColumnNames.MPP);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.MPP);
				else
					this.MPP = base.SetdecimalAsString(ColumnNames.MPP, value);
			}
		}

		public virtual string s_NetworkID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.NetworkID) ? string.Empty : base.GetintAsString(ColumnNames.NetworkID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.NetworkID);
				else
					this.NetworkID = base.SetintAsString(ColumnNames.NetworkID, value);
			}
		}

		public virtual string s_InvoiceID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.InvoiceID) ? string.Empty : base.GetintAsString(ColumnNames.InvoiceID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.InvoiceID);
				else
					this.InvoiceID = base.SetintAsString(ColumnNames.InvoiceID, value);
			}
		}

		public virtual string s_LastModifiedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.LastModifiedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedDate);
				else
					this.LastModifiedDate = base.SetDateTimeAsString(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual string s_LastModifiedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByUser) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByUser);
				else
					this.LastModifiedByUser = base.SetintAsString(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_CreatedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.CreatedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedDate);
				else
					this.CreatedDate = base.SetDateTimeAsString(ColumnNames.CreatedDate, value);
			}
		}

		public virtual string s_CreatedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedByUser) ? string.Empty : base.GetintAsString(ColumnNames.CreatedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedByUser);
				else
					this.CreatedByUser = base.SetintAsString(ColumnNames.CreatedByUser, value);
			}
		}

		public virtual string s_Memo
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Memo) ? string.Empty : base.GetstringAsString(ColumnNames.Memo);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Memo);
				else
					this.Memo = base.SetstringAsString(ColumnNames.Memo, value);
			}
		}

		public virtual string s_ContractCreatedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ContractCreatedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.ContractCreatedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ContractCreatedDate);
				else
					this.ContractCreatedDate = base.SetDateTimeAsString(ColumnNames.ContractCreatedDate, value);
			}
		}

		public virtual string s_ContractStartDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ContractStartDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.ContractStartDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ContractStartDate);
				else
					this.ContractStartDate = base.SetDateTimeAsString(ColumnNames.ContractStartDate, value);
			}
		}

		public virtual string s_ContractEndDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ContractEndDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.ContractEndDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ContractEndDate);
				else
					this.ContractEndDate = base.SetDateTimeAsString(ColumnNames.ContractEndDate, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ContractNo
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ContractNo, Parameters.ContractNo);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ProductDetailID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ProductDetailID, Parameters.ProductDetailID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Cost
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Cost, Parameters.Cost);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter MobileNumber
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MobileNumber, Parameters.MobileNumber);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PlanDescription
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PlanDescription, Parameters.PlanDescription);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PlanDuration
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PlanDuration, Parameters.PlanDuration);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Commission
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Commission, Parameters.Commission);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Rebate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Rebate, Parameters.Rebate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter MPP
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.MPP, Parameters.MPP);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter NetworkID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.NetworkID, Parameters.NetworkID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter InvoiceID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.InvoiceID, Parameters.InvoiceID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedByUser, Parameters.CreatedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Memo
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Memo, Parameters.Memo);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ContractCreatedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ContractCreatedDate, Parameters.ContractCreatedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ContractStartDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ContractStartDate, Parameters.ContractStartDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter ContractEndDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ContractEndDate, Parameters.ContractEndDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter ContractNo
		    {
				get
		        {
					if(_ContractNo_W == null)
	        	    {
						_ContractNo_W = TearOff.ContractNo;
					}
					return _ContractNo_W;
				}
			}

			public WhereParameter ProductDetailID
		    {
				get
		        {
					if(_ProductDetailID_W == null)
	        	    {
						_ProductDetailID_W = TearOff.ProductDetailID;
					}
					return _ProductDetailID_W;
				}
			}

			public WhereParameter Cost
		    {
				get
		        {
					if(_Cost_W == null)
	        	    {
						_Cost_W = TearOff.Cost;
					}
					return _Cost_W;
				}
			}

			public WhereParameter MobileNumber
		    {
				get
		        {
					if(_MobileNumber_W == null)
	        	    {
						_MobileNumber_W = TearOff.MobileNumber;
					}
					return _MobileNumber_W;
				}
			}

			public WhereParameter PlanDescription
		    {
				get
		        {
					if(_PlanDescription_W == null)
	        	    {
						_PlanDescription_W = TearOff.PlanDescription;
					}
					return _PlanDescription_W;
				}
			}

			public WhereParameter PlanDuration
		    {
				get
		        {
					if(_PlanDuration_W == null)
	        	    {
						_PlanDuration_W = TearOff.PlanDuration;
					}
					return _PlanDuration_W;
				}
			}

			public WhereParameter Commission
		    {
				get
		        {
					if(_Commission_W == null)
	        	    {
						_Commission_W = TearOff.Commission;
					}
					return _Commission_W;
				}
			}

			public WhereParameter Rebate
		    {
				get
		        {
					if(_Rebate_W == null)
	        	    {
						_Rebate_W = TearOff.Rebate;
					}
					return _Rebate_W;
				}
			}

			public WhereParameter MPP
		    {
				get
		        {
					if(_MPP_W == null)
	        	    {
						_MPP_W = TearOff.MPP;
					}
					return _MPP_W;
				}
			}

			public WhereParameter NetworkID
		    {
				get
		        {
					if(_NetworkID_W == null)
	        	    {
						_NetworkID_W = TearOff.NetworkID;
					}
					return _NetworkID_W;
				}
			}

			public WhereParameter InvoiceID
		    {
				get
		        {
					if(_InvoiceID_W == null)
	        	    {
						_InvoiceID_W = TearOff.InvoiceID;
					}
					return _InvoiceID_W;
				}
			}

			public WhereParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public WhereParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public WhereParameter CreatedByUser
		    {
				get
		        {
					if(_CreatedByUser_W == null)
	        	    {
						_CreatedByUser_W = TearOff.CreatedByUser;
					}
					return _CreatedByUser_W;
				}
			}

			public WhereParameter Memo
		    {
				get
		        {
					if(_Memo_W == null)
	        	    {
						_Memo_W = TearOff.Memo;
					}
					return _Memo_W;
				}
			}

			public WhereParameter ContractCreatedDate
		    {
				get
		        {
					if(_ContractCreatedDate_W == null)
	        	    {
						_ContractCreatedDate_W = TearOff.ContractCreatedDate;
					}
					return _ContractCreatedDate_W;
				}
			}

			public WhereParameter ContractStartDate
		    {
				get
		        {
					if(_ContractStartDate_W == null)
	        	    {
						_ContractStartDate_W = TearOff.ContractStartDate;
					}
					return _ContractStartDate_W;
				}
			}

			public WhereParameter ContractEndDate
		    {
				get
		        {
					if(_ContractEndDate_W == null)
	        	    {
						_ContractEndDate_W = TearOff.ContractEndDate;
					}
					return _ContractEndDate_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _ContractNo_W = null;
			private WhereParameter _ProductDetailID_W = null;
			private WhereParameter _Cost_W = null;
			private WhereParameter _MobileNumber_W = null;
			private WhereParameter _PlanDescription_W = null;
			private WhereParameter _PlanDuration_W = null;
			private WhereParameter _Commission_W = null;
			private WhereParameter _Rebate_W = null;
			private WhereParameter _MPP_W = null;
			private WhereParameter _NetworkID_W = null;
			private WhereParameter _InvoiceID_W = null;
			private WhereParameter _LastModifiedDate_W = null;
			private WhereParameter _LastModifiedByUser_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _CreatedDate_W = null;
			private WhereParameter _CreatedByUser_W = null;
			private WhereParameter _Memo_W = null;
			private WhereParameter _ContractCreatedDate_W = null;
			private WhereParameter _ContractStartDate_W = null;
			private WhereParameter _ContractEndDate_W = null;
			private WhereParameter _BranchID_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_ContractNo_W = null;
				_ProductDetailID_W = null;
				_Cost_W = null;
				_MobileNumber_W = null;
				_PlanDescription_W = null;
				_PlanDuration_W = null;
				_Commission_W = null;
				_Rebate_W = null;
				_MPP_W = null;
				_NetworkID_W = null;
				_InvoiceID_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_Deleted_W = null;
				_CreatedDate_W = null;
				_CreatedByUser_W = null;
				_Memo_W = null;
				_ContractCreatedDate_W = null;
				_ContractStartDate_W = null;
				_ContractEndDate_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ContractNo
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ContractNo, Parameters.ContractNo);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ProductDetailID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ProductDetailID, Parameters.ProductDetailID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Cost
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Cost, Parameters.Cost);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter MobileNumber
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MobileNumber, Parameters.MobileNumber);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PlanDescription
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PlanDescription, Parameters.PlanDescription);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PlanDuration
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PlanDuration, Parameters.PlanDuration);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Commission
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Commission, Parameters.Commission);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Rebate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Rebate, Parameters.Rebate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter MPP
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.MPP, Parameters.MPP);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter NetworkID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.NetworkID, Parameters.NetworkID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter InvoiceID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.InvoiceID, Parameters.InvoiceID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedByUser, Parameters.CreatedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Memo
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Memo, Parameters.Memo);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ContractCreatedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ContractCreatedDate, Parameters.ContractCreatedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ContractStartDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ContractStartDate, Parameters.ContractStartDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter ContractEndDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ContractEndDate, Parameters.ContractEndDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter ContractNo
		    {
				get
		        {
					if(_ContractNo_W == null)
	        	    {
						_ContractNo_W = TearOff.ContractNo;
					}
					return _ContractNo_W;
				}
			}

			public AggregateParameter ProductDetailID
		    {
				get
		        {
					if(_ProductDetailID_W == null)
	        	    {
						_ProductDetailID_W = TearOff.ProductDetailID;
					}
					return _ProductDetailID_W;
				}
			}

			public AggregateParameter Cost
		    {
				get
		        {
					if(_Cost_W == null)
	        	    {
						_Cost_W = TearOff.Cost;
					}
					return _Cost_W;
				}
			}

			public AggregateParameter MobileNumber
		    {
				get
		        {
					if(_MobileNumber_W == null)
	        	    {
						_MobileNumber_W = TearOff.MobileNumber;
					}
					return _MobileNumber_W;
				}
			}

			public AggregateParameter PlanDescription
		    {
				get
		        {
					if(_PlanDescription_W == null)
	        	    {
						_PlanDescription_W = TearOff.PlanDescription;
					}
					return _PlanDescription_W;
				}
			}

			public AggregateParameter PlanDuration
		    {
				get
		        {
					if(_PlanDuration_W == null)
	        	    {
						_PlanDuration_W = TearOff.PlanDuration;
					}
					return _PlanDuration_W;
				}
			}

			public AggregateParameter Commission
		    {
				get
		        {
					if(_Commission_W == null)
	        	    {
						_Commission_W = TearOff.Commission;
					}
					return _Commission_W;
				}
			}

			public AggregateParameter Rebate
		    {
				get
		        {
					if(_Rebate_W == null)
	        	    {
						_Rebate_W = TearOff.Rebate;
					}
					return _Rebate_W;
				}
			}

			public AggregateParameter MPP
		    {
				get
		        {
					if(_MPP_W == null)
	        	    {
						_MPP_W = TearOff.MPP;
					}
					return _MPP_W;
				}
			}

			public AggregateParameter NetworkID
		    {
				get
		        {
					if(_NetworkID_W == null)
	        	    {
						_NetworkID_W = TearOff.NetworkID;
					}
					return _NetworkID_W;
				}
			}

			public AggregateParameter InvoiceID
		    {
				get
		        {
					if(_InvoiceID_W == null)
	        	    {
						_InvoiceID_W = TearOff.InvoiceID;
					}
					return _InvoiceID_W;
				}
			}

			public AggregateParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public AggregateParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public AggregateParameter CreatedByUser
		    {
				get
		        {
					if(_CreatedByUser_W == null)
	        	    {
						_CreatedByUser_W = TearOff.CreatedByUser;
					}
					return _CreatedByUser_W;
				}
			}

			public AggregateParameter Memo
		    {
				get
		        {
					if(_Memo_W == null)
	        	    {
						_Memo_W = TearOff.Memo;
					}
					return _Memo_W;
				}
			}

			public AggregateParameter ContractCreatedDate
		    {
				get
		        {
					if(_ContractCreatedDate_W == null)
	        	    {
						_ContractCreatedDate_W = TearOff.ContractCreatedDate;
					}
					return _ContractCreatedDate_W;
				}
			}

			public AggregateParameter ContractStartDate
		    {
				get
		        {
					if(_ContractStartDate_W == null)
	        	    {
						_ContractStartDate_W = TearOff.ContractStartDate;
					}
					return _ContractStartDate_W;
				}
			}

			public AggregateParameter ContractEndDate
		    {
				get
		        {
					if(_ContractEndDate_W == null)
	        	    {
						_ContractEndDate_W = TearOff.ContractEndDate;
					}
					return _ContractEndDate_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _ContractNo_W = null;
			private AggregateParameter _ProductDetailID_W = null;
			private AggregateParameter _Cost_W = null;
			private AggregateParameter _MobileNumber_W = null;
			private AggregateParameter _PlanDescription_W = null;
			private AggregateParameter _PlanDuration_W = null;
			private AggregateParameter _Commission_W = null;
			private AggregateParameter _Rebate_W = null;
			private AggregateParameter _MPP_W = null;
			private AggregateParameter _NetworkID_W = null;
			private AggregateParameter _InvoiceID_W = null;
			private AggregateParameter _LastModifiedDate_W = null;
			private AggregateParameter _LastModifiedByUser_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _CreatedDate_W = null;
			private AggregateParameter _CreatedByUser_W = null;
			private AggregateParameter _Memo_W = null;
			private AggregateParameter _ContractCreatedDate_W = null;
			private AggregateParameter _ContractStartDate_W = null;
			private AggregateParameter _ContractEndDate_W = null;
			private AggregateParameter _BranchID_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_ContractNo_W = null;
				_ProductDetailID_W = null;
				_Cost_W = null;
				_MobileNumber_W = null;
				_PlanDescription_W = null;
				_PlanDuration_W = null;
				_Commission_W = null;
				_Rebate_W = null;
				_MPP_W = null;
				_NetworkID_W = null;
				_InvoiceID_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_Deleted_W = null;
				_CreatedDate_W = null;
				_CreatedByUser_W = null;
				_Memo_W = null;
				_ContractCreatedDate_W = null;
				_ContractStartDate_W = null;
				_ContractEndDate_W = null;
				_BranchID_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ContractsInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ContractsUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_ContractsDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ContractNo);
			p.SourceColumn = ColumnNames.ContractNo;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ProductDetailID);
			p.SourceColumn = ColumnNames.ProductDetailID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Cost);
			p.SourceColumn = ColumnNames.Cost;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.MobileNumber);
			p.SourceColumn = ColumnNames.MobileNumber;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PlanDescription);
			p.SourceColumn = ColumnNames.PlanDescription;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PlanDuration);
			p.SourceColumn = ColumnNames.PlanDuration;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Commission);
			p.SourceColumn = ColumnNames.Commission;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Rebate);
			p.SourceColumn = ColumnNames.Rebate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.MPP);
			p.SourceColumn = ColumnNames.MPP;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.NetworkID);
			p.SourceColumn = ColumnNames.NetworkID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.InvoiceID);
			p.SourceColumn = ColumnNames.InvoiceID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedDate);
			p.SourceColumn = ColumnNames.LastModifiedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByUser);
			p.SourceColumn = ColumnNames.LastModifiedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedDate);
			p.SourceColumn = ColumnNames.CreatedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedByUser);
			p.SourceColumn = ColumnNames.CreatedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Memo);
			p.SourceColumn = ColumnNames.Memo;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ContractCreatedDate);
			p.SourceColumn = ColumnNames.ContractCreatedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ContractStartDate);
			p.SourceColumn = ColumnNames.ContractStartDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.ContractEndDate);
			p.SourceColumn = ColumnNames.ContractEndDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
